# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FirebaseHosting.V1beta1.Model.Version do
  @moduledoc """
  A `Version` is a configuration and a collection of static files which determine how a site is displayed.

  ## Attributes

  *   `config` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.ServingConfig.t`, *default:* `nil`) - The configuration for the behavior of the site. This configuration exists in the [`firebase.json`](https://firebase.google.com/docs/cli/#the_firebasejson_file) file.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which the version was created.
  *   `createUser` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t`, *default:* `nil`) - Output only. Identifies the user who created the version.
  *   `deleteTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which the version was `DELETED`.
  *   `deleteUser` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t`, *default:* `nil`) - Output only. Identifies the user who `DELETED` the version.
  *   `fileCount` (*type:* `String.t`, *default:* `nil`) - Output only. The total number of files associated with the version. This value is calculated after a version is `FINALIZED`.
  *   `finalizeTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time at which the version was `FINALIZED`.
  *   `finalizeUser` (*type:* `GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t`, *default:* `nil`) - Output only. Identifies the user who `FINALIZED` the version.
  *   `labels` (*type:* `map()`, *default:* `nil`) - The labels used for extra metadata and/or filtering.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The fully-qualified resource name for the version, in the format: sites/ SITE_ID/versions/VERSION_ID This name is provided in the response body when you call [`CreateVersion`](sites.versions/create).
  *   `status` (*type:* `String.t`, *default:* `nil`) - The deploy status of the version. For a successful deploy, call [`CreateVersion`](sites.versions/create) to make a new version (`CREATED` status), [upload all desired files](sites.versions/populateFiles) to the version, then [update](sites.versions/patch) the version to the `FINALIZED` status. Note that if you leave the version in the `CREATED` state for more than 12 hours, the system will automatically mark the version as `ABANDONED`. You can also change the status of a version to `DELETED` by calling [`DeleteVersion`](sites.versions/delete).
  *   `versionBytes` (*type:* `String.t`, *default:* `nil`) - Output only. The total stored bytesize of the version. This value is calculated after a version is `FINALIZED`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :config => GoogleApi.FirebaseHosting.V1beta1.Model.ServingConfig.t() | nil,
          :createTime => DateTime.t() | nil,
          :createUser => GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t() | nil,
          :deleteTime => DateTime.t() | nil,
          :deleteUser => GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t() | nil,
          :fileCount => String.t() | nil,
          :finalizeTime => DateTime.t() | nil,
          :finalizeUser => GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser.t() | nil,
          :labels => map() | nil,
          :name => String.t() | nil,
          :status => String.t() | nil,
          :versionBytes => String.t() | nil
        }

  field(:config, as: GoogleApi.FirebaseHosting.V1beta1.Model.ServingConfig)
  field(:createTime, as: DateTime)
  field(:createUser, as: GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser)
  field(:deleteTime, as: DateTime)
  field(:deleteUser, as: GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser)
  field(:fileCount)
  field(:finalizeTime, as: DateTime)
  field(:finalizeUser, as: GoogleApi.FirebaseHosting.V1beta1.Model.ActingUser)
  field(:labels, type: :map)
  field(:name)
  field(:status)
  field(:versionBytes)
end

defimpl Poison.Decoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Version do
  def decode(value, options) do
    GoogleApi.FirebaseHosting.V1beta1.Model.Version.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FirebaseHosting.V1beta1.Model.Version do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
